#include <iostream>
#include <vector>

using namespace std;

// 3202. 找出有效子序列的最大长度 II
// https://leetcode.cn/problems/find-the-maximum-length-of-valid-subsequence-ii/description/?envType=daily-question&envId=2025-07-17

class Solution {
public:
    int maximumLength(vector<int>& nums, int k) {
        vector<vector<int>> dp(k, vector<int>(k));
        int ans = 0;
        for (int curNum : nums)
        {
            int x = curNum % k;
            for (int y = 0; y < k; y++)
            {
                dp[y][x] = dp[x][y] + 1;
                ans = max(ans, dp[y][x]);
            }
        }
        return ans;
    }
};

int main()
{
    return 0;
}